package com.ruoyi.environment.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.environment.mapper.OpmEnvEnterpriseEquipmentMapper;
import com.ruoyi.environment.domain.OpmEnvEnterpriseEquipment;
import com.ruoyi.environment.service.IOpmEnvEnterpriseEquipmentService;

/**
 * 企业设备Service业务层处理
 *
 * @author cjie
 * @date 2021-07-23
 */
@Service
public class OpmEnvEnterpriseEquipmentServiceImpl implements IOpmEnvEnterpriseEquipmentService {
    @Autowired
    private OpmEnvEnterpriseEquipmentMapper opmEnvEnterpriseEquipmentMapper;

    /**
     * 查询企业设备
     *
     * @param id 企业设备ID
     * @return 企业设备
     */
    @Override
    public OpmEnvEnterpriseEquipment selectOpmEnvEnterpriseEquipmentById(Long id) {
        return opmEnvEnterpriseEquipmentMapper.selectOpmEnvEnterpriseEquipmentById(id);
    }

    /**
     * 查询企业设备列表
     *
     * @param opmEnvEnterpriseEquipment 企业设备
     * @return 企业设备
     */
    @Override
    public List<OpmEnvEnterpriseEquipment> selectOpmEnvEnterpriseEquipmentList(OpmEnvEnterpriseEquipment opmEnvEnterpriseEquipment) {
        return opmEnvEnterpriseEquipmentMapper.selectOpmEnvEnterpriseEquipmentList(opmEnvEnterpriseEquipment);
    }

    /**
     * 新增企业设备
     *
     * @param opmEnvEnterpriseEquipment 企业设备
     * @return 结果
     */
    @Override
    public int insertOpmEnvEnterpriseEquipment(OpmEnvEnterpriseEquipment opmEnvEnterpriseEquipment) {
        opmEnvEnterpriseEquipment.setId(IdUtil.getSnowflake(0, 0).nextId());
        opmEnvEnterpriseEquipment.setCreateTime(DateUtils.getNowDate());
        opmEnvEnterpriseEquipment.setCreateBy(SecurityUtils.getUsername());
        return opmEnvEnterpriseEquipmentMapper.insertOpmEnvEnterpriseEquipment(opmEnvEnterpriseEquipment);
    }

    /**
     * 修改企业设备
     *
     * @param opmEnvEnterpriseEquipment 企业设备
     * @return 结果
     */
    @Override
    public int updateOpmEnvEnterpriseEquipment(OpmEnvEnterpriseEquipment opmEnvEnterpriseEquipment) {
        opmEnvEnterpriseEquipment.setUpdateTime(DateUtils.getNowDate());
        opmEnvEnterpriseEquipment.setUpdateBy(SecurityUtils.getUsername());
        return opmEnvEnterpriseEquipmentMapper.updateOpmEnvEnterpriseEquipment(opmEnvEnterpriseEquipment);
    }

    /**
     * 批量删除企业设备
     *
     * @param ids 需要删除的企业设备ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvEnterpriseEquipmentByIds(Long[] ids) {
        return opmEnvEnterpriseEquipmentMapper.deleteOpmEnvEnterpriseEquipmentByIds(ids);
    }

    /**
     * 删除企业设备信息
     *
     * @param id 企业设备ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvEnterpriseEquipmentById(Long id) {
        return opmEnvEnterpriseEquipmentMapper.deleteOpmEnvEnterpriseEquipmentById(id);
    }
}
